// 控制Alert的Dispatch映射
export const AlertDispatch = (dispatch) => {
    return {
        showAlertFn(textvalue,color) {
            const action = {
                type: "showalert",
                value: {
                    textvalue,
                    color
                }
            }
            dispatch(action)
            setTimeout(() => {
                dispatch({type: "hidealert"})
            },1500)
        },
    }
}

// 控制Loading的Dispatch映射
export const LodingDispatch = (dispatch) => {
    return {
        openLoadingFn() {
            dispatch({ type: "openLoading" })
        },
        closeLoadingFn() {
            dispatch({ type: "closeLoading" });
        },
        ...AlertDispatch(dispatch)
    }
}